package com.zhou.zhxy.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhou.zhxy.pojo.Teacher;
import com.zhou.zhxy.service.TeacherService;
import com.zhou.zhxy.util.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.nio.file.Path;

/**
 * RestController  异步交互使用
 */

@RestController
@RequestMapping("/sms/teacherController")
public class TeacherController {

    @Autowired
    private TeacherService teacherService;

    @ApiOperation("获取老师信息")
    @GetMapping("/getTeachers/{pageNo}/{pageSize}")
    public Result getTeachers(
            @ApiParam("页码") @PathVariable("pageNo") Integer pageNo,
            @ApiParam("条数") @PathVariable("pageNo") Integer pageSize,
            @ApiParam("分页查询")Teacher teacher
    ){
        Page<Teacher> page = new Page<>(pageNo,pageSize);

        IPage<Teacher> ipage = teacherService.getTeacherList(page,teacher);

        return Result.ok(ipage);

    }
}
